package com.yitong.xjd.controller;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.yitong.xjd.domain.Test;
import com.yitong.xjd.services.TestService;

@RestController
@RequestMapping("/xjd")
public class TestController {
	
	private Logger logger = LoggerFactory.getLogger(getClass());

	@Autowired
	private TestService testService;

	@ResponseBody
	@RequestMapping(value="/getTest")
	public String getTest(String name) {
		logger.info("test controller..."+name);
		Test test=testService.findTestByName(name);
		return JSON.toJSONString(test);
	}
	
	@ResponseBody
	@RequestMapping(value="/getTestPageList")
	public String getTestPageList(String nextPage,String pageSize) {
		logger.info("test page controller...");
		List<Test> list=(List<Test>)testService.getPageList(Integer.valueOf(nextPage),Integer.valueOf(pageSize));
		return JSON.toJSONString(list);
	}

}